package withdraw

import (
	"github.com/xinliangnote/go-gin-api/internal/pkg/core"
	"github.com/xinliangnote/go-gin-api/internal/repository/mongodb/withdraw"
)

func (s *service) List(ctx core.Context, pageIndex uint, pageSize uint, chainName string) (productList []withdraw.Withdraw, err error) {
	model := withdraw.NewModel()
	if chainName != "" {
		model.ChainName = chainName
	}
	list, err := model.List(s.db.GetDb(), pageIndex, pageSize)
	return list, err
}

func (s *service) Count(ctx core.Context, chainName string) (int64, error) {
	model := withdraw.NewModel()

	if chainName != "" {
		model.ChainName = chainName
	}
	count, err := model.Count(s.db.GetDb())
	return count, err
}
